int thirdMax(int* nums, int numsSize)
{
    int *first=NULL,*second=NULL,*third=NULL;
    for (int i = 0; i < numsSize; i++)
    {
        if (first==NULL || nums[i] > *first)
        {
            third = second;
            second = first;
            first = &nums[i];
        }
        else if ( nums[i] < *first && ( second == NULL || nums[i] > *second ) )
        {
            third = second;
            second = &nums[i];
        }
        else if ( second != NULL && *second > nums[i] && ( third == NULL || nums[i] > *third ) )
        {
            third = &nums[i];
        }
    }
        return third==NULL? *first:*third;
}